package com.wrupple.muba.desktop.server.bussiness.seo;

import javax.servlet.http.HttpServletRequest;

public class SEORequestFilterImpl implements SEORequestFilter {

	private String[] agents = { "Slurp", "Googlebot", "MSNBot", "Jeeves", "ia_archiver", "msnbot",
			"Mediapartners-Google" };

	@Override
	public boolean shouldRedirectToStandardView(HttpServletRequest request) {
		String ua = request.getHeader("User-Agent");
		if (isSearchEngine(ua)) {
			return false;
		} else {
			return true;
		}
	}

	private boolean isSearchEngine(String ua) {
		for (String agent : agents) {
			if (ua.contains(agent)) {
				return true;
			}
		}
		return false;
	}

}
